package com.rhb.rhbaiagent.model.dao;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.rhb.rhbaiagent.model.domain.ConversationMemory;
import com.rhb.rhbaiagent.model.mapper.ConversationMemoryMapper;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class ConversationMemoryDAO extends ServiceImpl<ConversationMemoryMapper, ConversationMemory> {
    public List<ConversationMemory> getMessages(String conversationId){
        return this.lambdaQuery()
                .eq(ConversationMemory::getConversationId, conversationId)
                .list();
    }

    public boolean deleteMemory(String conversationId){
        return this.lambdaUpdate()
                .eq(ConversationMemory::getConversationId, conversationId)
                .remove();
    }
}
